package cn.iocoder.yudao.module.product.dal.mysql.specifications;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.product.dal.dataobject.specifications.SpecificationsDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.product.controller.admin.specifications.vo.*;

/**
 * 商品规格 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface SpecificationsMapper extends BaseMapperX<SpecificationsDO> {

    default PageResult<SpecificationsDO> selectPage(SpecificationsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SpecificationsDO>()
                .eqIfPresent(SpecificationsDO::getSkuId, reqVO.getSkuId())
                .eqIfPresent(SpecificationsDO::getSpuId, reqVO.getSpuId())
                .eqIfPresent(SpecificationsDO::getStatus, reqVO.getStatus())
                .eqIfPresent(SpecificationsDO::getProductCode, reqVO.getProductCode())
                .eqIfPresent(SpecificationsDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(SpecificationsDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SpecificationsDO::getId));
    }

}